<?php
/**
 * Created by PhpStorm.
 * User: ly
 * Date: 2018\1\17 0017
 * Time: 11:16
 */

use common\models\UserModel;

$userModel = new UserModel();
?>
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word"
      xmlns="http://www.w3.org/TR/REC-html40">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <xml>
        <w:WordDocument>
            <w:View>Print</w:View>
    </xml>
    <style>
        body {font-family: 微软雅黑;}
        .bg {background-color: #c7d9f0}
        table tr td {word-break: break-all;font-size: 14px;line-height: 30px;padding: 5px;}
        tr{height: 40px;}
        .th_width {width: 100px;word-break: break-all;}
        .red_font {color: red;}
    </style>

</head>
<body>
<h1 style="text-align: center;padding-bottom: 20px;border-bottom: 1px solid #E2E8FF;margin-top: 150px;font-size:36px">立项报告</h1>
<h2 style="text-align: center;font-size:22px"><?php echo $data['title']; ?>资产包</h2>
<span lang=EN-US style="font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:"
      mce_style="font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:" Times New Roman\';mso-fareast-font-family:宋体;mso-font-kerning:1.0pt;mso-ansi-language
EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA\'><br clear=all style="page-break-before:always"
                                                               mce_style="page-break-before:always"></span>
<h3 style="text-align: center;">立项报告</h3>
<h4>一、立项信息</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;" width="100%">
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">申请立项理由</td>
        <td colspan="3"><?php echo $data['initiation']['reason']; ?></td>
    </tr>
    <tr>
        <td colspan="4"><b>资产包基本情况</b></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">债权人名称</td>
        <td colspan="3"><?php echo $data['creditor']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">本金</td>
        <td colspan="3"><?php echo $data['principal']?Yii::$app->formatter->asDecimal($data['principal']):''; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">利息</td>
        <td colspan="3"><?php echo $data['interest']?Yii::$app->formatter->asDecimal($data['interest']):''; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">户数</td>
        <td colspan="3"><?php echo $data['hushu']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">抵押本金</td>
        <td colspan="3"><?php echo $projectsType2Principal?Yii::$app->formatter->asDecimal($projectsType2Principal):''; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">已诉项目户数</td>
        <td colspan="3"><?php echo $projectsSuitCount; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">已诉本金占比</td>
        <td colspan="3"><?php echo $principalB; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">未诉债权时效情况及催收方式</td>
        <td colspan="3"><?php echo $data['limit_collection']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">破产本金</td>
        <td colspan="3"><?php echo $data['broke_principal']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">其他补充</td>
        <td colspan="3"><?php echo $data['detail']; ?></td>
    </tr>
    <tr>
        <td colspan="4"><b>流转、前期处置及维护情况</b></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">转让日期</td>
        <td class="bg">转让/处置方</td>
        <td class="bg">转让/处置内容</td>
        <td class="bg">备注</td>
    </tr>
    <?php
    foreach ($data['history'] as $value) {
        echo '<tr><td>' . $value['transfer_date'] . '</td><td>' . $value['transfer'] . '</td><td>' . $value['content'] . '</td><td>' . $value['remark'] . '</td></tr>';
    }
    ?>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">卖家提供的信息资料</td>
        <td colspan="3"><?php echo $data['initiation']['seller_files']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">资产成交的期限和成交方式</td>
        <td colspan="3"><?php echo $data['initiation']['deal_method']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">当地共同处置资产包的合作伙伴情况</td>
        <td colspan="3"><?php echo $data['initiation']['partners']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">当地司法环境对所立项目的法律支持分析</td>
        <td colspan="3"><?php echo $data['initiation']['law']; ?></td>
    </tr>
    <tr>
        <td colspan="4" style="width: 100px;word-break: break-all;"><b>卖家报价及未来价格可谈判空间</b></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">当前卖方报价（预估售价）</td>
        <td colspan="3"><?php echo $data['initiation']['bargain']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">未来价格可谈判空间</td>
        <td colspan="3"><?php echo $data['initiation']['future_price_space']; ?></td>
    </tr>
</table>
<h4>二、报价信息</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;width: 100%">
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">获取其他买家的信息、报价情况、工作进展情况</td>
        <td colspan="3"><?php echo $data['initiation']['price_detail1']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">采取通道方式成交的，明确通道主体及费用</td>
        <td colspan="3"><?php echo $data['initiation']['price_detail2']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">与卖家进行价格谈判，并初步确定成交价格、成交方式及付款方式料</td>
        <td colspan="3"><?php echo $data['initiation']['price_detail3']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">是否已经获得投资人和通道的收购承诺函</td>
        <td colspan="3"><?php echo $data['initiation']['price_detail4']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">资产包交接清单的确认，原件资料核对无误</td>
        <td colspan="3"><?php echo $data['initiation']['price_detail5']; ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">资产包存在的风险</td>
        <td colspan="3"><?php echo $data['initiation']['price_detail6']; ?></td>
    </tr>
</table>
<h4>三、团队组成</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;" width="100%">
    <tr>
        <td colspan="4"><b>团队组成</b></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">资产包负责人</td>
        <td colspan="3"><?php echo $userModel->getUserStr($data['initiation']['leader']); ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">预评估</td>
        <td colspan="3"><?php echo $userModel->getUserStr($data['initiation']['pre_evaluation']); ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">尽调成员</td>
        <td colspan="3"><?php echo $userModel->getUserStr($data['initiation']['due_diligence']); ?></td>
    </tr>
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">其他说明</td>
        <td colspan="3"><?php echo $data['initiation']['other_team_notes']; ?></td>
    </tr>
</table>
<h4>四、工作计划</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;" width="100%">
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">时间</td>
        <td class="bg">工作节点</td>
    </tr>
    <?php
    foreach ($data['plan'] as $value) {
        echo '<tr><td>' . $value['stage'] . '</td><td>' . $value['job'] . '</td></tr>';
    }
    ?>
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>
<h4>五、团队收益分配</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;" width="100%">
    <tr>
        <td class="bg" style="width: 100px;word-break: break-all;">阶段</td>
        <td class="bg">成员及分配比例</td>
    </tr>
    <?php
    foreach ($data['income'] as $value) {
        echo '<tr><td>' . $value['stage'] . '</td><td>' . $value['profit'] . '</td></tr>';
    }
    ?>
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>
<h4>六、其他需要说明的事项</h4>
<table border="1" bordercolor="#bfbfbf" style="border-collapse:collapse;" width="100%">
    <tr>
        <td><?php echo $data['initiation']['other_notes']; ?></td>
    </tr>
</table>
</body>
</html>
<?php
ob_start(); //打开缓冲区
header("Cache-Control: public");
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
$fileName=$data['title'].'_立项报告'.date("Ymd");//His
if (strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE')) {
    header('Content-Disposition: attachment; filename='.$fileName.'.doc');
} else if (strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox')) {
    Header('Content-Disposition: attachment; filename='.$fileName.'.doc');
} else {
    header('Content-Disposition: attachment; filename='.$fileName.'.doc');
}
header("Pragma:no-cache");
header("Expires:0");
ob_end_flush();//输出全部内容到浏览器
?>
